global u16 coldPeaksZone.mechaTails.position.x
global u16 coldPeaksZone.mechaTails.position.y
global u8 coldPeaksZone.mechaTails.introTimer
global u8 coldPeaksZone.mechaTails.hitsRemaining
global u8 coldPeaksZone.mechaTails.hasBeenFought
global u16 coldPeaksZone.mechaTails.resultsTimer

global bool coldPeaksZone.mechaTails.isCharging
global bool coldPeaksZone.mechaTails.holdingSnowball

global u8 coldPeaksZone.bossSprite

//Mecha Tails' other code
function void coldPeaksZone.mechaTailsStuff()
{
	coldPeaksZone.skippedCPZ = 0
	
	if level.restart
		return

	if (allocDynamicObjectStd()) && coldPeaksZone.mechaTails.introTimer == 9
	{
		// Create the object that fades out level music and starts the boss theme afterwards
		objA1.update_address = 0x085b30
		u8[A1 + 0x2c] = MUSIC_MAINBOSS
	}
	if coldPeaksZone.mechaTails.introTimer == 0x7c
	{
		coldPeaksZone.loadMechaTailsPalette(false, false)
		coldPeaksZone.spawnMechaTailsObject()
	}

	if coldPeaksZone.mechaTails.hitsRemaining != 0
	{
		if camera.position.y.u16 < 0x0490
			camera.position.y.u16 = 0x0490
		if camera.position.x.u16 >= 0x6023
			move_area.left = 0x6023
		move_area.right = 0x6023 + getScreenExtend() * 2
		level.boss_encounter = 1
	}
	else if coldPeaksZone.mechaTails.hasBeenFought == 1
	{
		move_area.left = 0x6023
		if global.act.apparent == 0
			move_area.right = 0x6023 + getScreenExtend() * 2
		else move_area.right = 0x6bf0
		level.boss_encounter = 0
	}
}

//Mecha Tails
function void coldPeaksZone.spawnMechaTailsObject()
{
	if (allocDynamicObjectStd())
	{
		zeroMemory(A1, 0x4a)
		objA1.update_address = addressof(coldPeaksZone.updateMechaTailsObject)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE | render_flag.FLIP_X)
		
		objA1.box_size.x = 0x40
		objA1.box_size.y = 0x40
		
		objA1.position.x.u16 = global.act.apparent == 1 ? 0x60e0 : camera.position.x.u16 + getScreenWidth() - 32
		objA1.position.y.u16 = global.act.apparent == 1 ? 0x0546 : 0x0466
		
		objA1.base_state = global.act.apparent == 1 ? 0x04 : 0x00
		
		objA1.collision_attributes = (collision.size.16x16 | collision.flag.DESTRUCTIBLE)
		
		if global.act.apparent == 1
		{
			coldPeaksZone.mechaTails.hitsRemaining = 0x00
			u8[A1 + 0x29] = 0x01
		}
		else
		{
			coldPeaksZone.mechaTails.hitsRemaining = 0x0d
			u8[A1 + 0x29] = 0x0d //13 hits

			u32 backupA0 = A0
			A0 = A1
			RegisterBossHealthBar(A0 + 0x29, 0xff, 0)
			A0 = backupA0
		}
	}
}

//# address-hook(0x200400)
function void coldPeaksZone.updateMechaTailsObject()
{
	objA0.box_size.x = 0x40
	objA0.box_size.y = 0x40
	
	objA0.hitbox_extends.x = 16
	objA0.hitbox_extends.y = 16
	
	if objA0.velocity.x < 0
		objA0.render_flags |= render_flag.FLIP_X
	else if objA0.velocity.x > 0
		objA0.render_flags &= ~render_flag.FLIP_X

	Enemy.DrawDynamicObject()

	coldPeaksZone.mechaTails.hitsRemaining = boss.remaining_hits
	
	if boss.remaining_hits == 0 && u16[0xffffb000 + 0x10] < (0x6588 + getScreenExtend() - 40)
	{
		objA0.base_state = 0x04
		if coldPeaksZone.mechaTails.resultsTimer < 90
			coldPeaksZone.mechaTails.resultsTimer += 1
		if coldPeaksZone.mechaTails.resultsTimer >= 90
		{
			level.default_music.u8 = 0x0b
			if coldPeaksZone.destroyMechaTails()
			{
				coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, 0x130, -0x300, 4)
				coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, -0x130, -0x300, 3)
				coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, 0xa0, -0x400, 2)
				coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, -0xa0, -0x400, 1)
				coldPeaksZone.mechaTails.hasBeenFought = 1
				coldPeaksZone.mechaTails.position.y = 0x0546
				UnloadObject()
				return
			}
			else
			{
				if coldPeaksZone.mechaTails.position.y < 0x0546
				{
					UpdateMovementStraightSimple()
					objA0.velocity.y += 0x20
				}
				else
				{
					coldPeaksZone.mechaTails.hasBeenFought = 1
				}
			}
		}
		if coldPeaksZone.mechaTails.resultsTimer >= 90
		{
			if coldPeaksZone.mechaTails.position.y >= 1347 && coldPeaksZone.mechaTails.resultsTimer == 92 && level.wait_for_results == 0
			{
				player2.control_override = 0xff
				if u16[0xffffb04a + 0x10] > (coldPeaksZone.mechaTails.position.x + 32)
				{
					control.tails = 0x0400
				}
				else if u16[0xffffb04a + 0x10] < (coldPeaksZone.mechaTails.position.x + 24)
				{
					control.tails = 0x0800
				}
				else if u16[0xffffb04a + 0x10] >= (coldPeaksZone.mechaTails.position.x + 24) && u16[0xffffb04a + 0x10] < (coldPeaksZone.mechaTails.position.x + 32)
				{
					if u8[0xffffb04a + 0x2a] & char.flag.FACING_LEFT
						control.tails = 0x0200
					else control.tails = 0x0800
				}
			}
		}
	}
	
	if objA0.base_state == 0x00
	{
		if objA0.position.y.u16 < 0x04c0
		{
			UpdateMovementStraightSimple()
			objA0.velocity.y += 0x07
		}
		else
		{
			if objA0.velocity.y > 0
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y -= 0x20
			}
			else
			{
				Audio.playAudio("coldpeakszone.mechatails.dash")
				objA0.base_state = 0x01
			}
		}
	}
	
	if objA0.base_state == 0x01
	{
		u16 speed = (boss.remaining_hits < 0x05) ? 0xa00 : 0x700
		u16 turn = (boss.remaining_hits < 0x05) ? 20 : 32
		
		objA0.velocity.y = 0
		if objA0.flags2b == 0x00
		{
			UpdateMovementStraightSimple()
			if objA0.velocity.x > -speed
				objA0.velocity.x -= 0x20
			else objA0.velocity.x = -speed
			if objA0.position.x.u16 < camera.position.x.u16 - 32
			{
				objA0.position.y.u16 += turn
				objA0.velocity.x = -objA0.velocity.x
				objA0.flags2b = 0x01
				Audio.playAudio("coldpeakszone.mechatails.dash")
			}
		}
		if objA0.flags2b == 0x01
		{
			UpdateMovementStraightSimple()
			if objA0.velocity.x < speed
				objA0.velocity.x += 0x20
			else objA0.velocity.x = speed
			if objA0.position.x.u16 > camera.position.x.u16 + getScreenWidth() + 32
			{
				if objA0.position.y.u16 >= 0x0532
				{
					coldPeaksZone.switchPattern()
				}
				else
				{
					objA0.position.y.u16 += turn
					objA0.velocity.x = -objA0.velocity.x
					objA0.flags2b = 0x00
					Audio.playAudio("coldpeakszone.mechatails.dash")
				}
			}
		}
	}
	if objA0.base_state == 0x02
	{
		if objA0.countdown_value == 0
			objA0.countdown_value = 45
		if (checkBoxOverlap(objA0.position.x.u16, objA0.position.y.u16, 1, 1, camera.position.x.u16, camera.position.y.u16, getScreenWidth(), getScreenHeight()) || objA0.countdown_value == 1 || objA0.countdown_value == 18)
			objA0.countdown_value -= 1
		
		if boss.remaining_hits <= 4
		{
			if objA0.position.y.u16 < 0x04da
			{
				objA0.velocity.y = 0x200
			}
			else
			{
				if objA0.velocity.y > 0
					objA0.velocity.y -= 0x30
				else objA0.velocity.y = 0
			}

			if objA0.countdown_value == 18
			{
				playSound(0x54)
				coldPeaksZone.spawnLaser()
			}
		}
		else
		{
			if objA0.countdown_value == 1
			{
				playSound(0x5E)
				coldPeaksZone.spawnEnergyBall()
			}
		}
		if objA0.flags2b == 0x00
		{
			UpdateMovementStraightSimple()
			objA0.velocity.x = -0x200
			if objA0.position.x.u16 < camera.position.x.u16 - 17
			{
				objA0.flags2b = 0x01
			}
		}
		if objA0.flags2b == 0x01
		{
			UpdateMovementStraightSimple()
			objA0.velocity.x = 0x200
			if objA0.position.x.u16 > camera.position.x.u16 + getScreenWidth() + 17
			{
				coldPeaksZone.switchPattern()
			}
		}
	}
	if objA0.base_state == 0x03
	{
		if objA0.flags2b == 0x00
		{
			if objA0.velocity.x < 0x30
			{
				UpdateMovementStraightSimple()
				objA0.velocity.x += 0x0a
			}
			else
			{
				objA0.velocity.x = 0
				Audio.playAudio("dropdash_charge", AudioContext.CONTEXT_SOUND)
				objA0.flags2b = 0x01
			}
		}
		if objA0.flags2b == 0x01
		{
			CheckGroundCollision()
			if !(D1.s16 <= 0)
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y += 0x28
				objA0.velocity.x = 0
			}
			else
			{
				if objA0.velocity.x == 0
				{
					coldPeaksZone.spawnDropDashDust(true)
					Audio.playAudio("dropdash_release", AudioContext.CONTEXT_SOUND)
				}
				if objA0.position.x.u16 > camera.position.x.u16 - 17
				{
					UpdateMovementStraightSimple()
					objA0.velocity.y = 0x00
					objA0.velocity.x = -0x840
				}
				else 
				{
					objA0.position.y.u16 = 0x04d5 + (coldPeaksZone.lowerMechaTailsPosition() ? 16 : 0)
					objA0.position.x.u16 = camera.position.x.u16 - 17
					objA0.velocity.x = 0x200
					objA0.flags2b = 0x02
				}
			}
		}
		if objA0.flags2b == 0x02
		{
			if objA0.velocity.x > -0x30
			{
				UpdateMovementStraightSimple()
				objA0.velocity.x -= 0x0a
			}
			else
			{
				objA0.velocity.x = 0
				Audio.playAudio("dropdash_charge", AudioContext.CONTEXT_SOUND)
				objA0.flags2b = 0x03
			}
		}
		if objA0.flags2b == 0x03
		{
			CheckGroundCollision()
			if !(D1.s16 <= 0)
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y += 0x28
				objA0.velocity.x = 0
			}
			else
			{
				if objA0.position.x.u16 < camera.position.x.u16 + getScreenWidth() + 17
				{
					if objA0.velocity.x == 0
					{
						coldPeaksZone.spawnDropDashDust(false)
						Audio.playAudio("dropdash_release", AudioContext.CONTEXT_SOUND)
					}
					UpdateMovementStraightSimple()
					objA0.velocity.y = 0x00
					objA0.velocity.x = 0x840
				}
				else
				{
					coldPeaksZone.switchPattern()
				}
			}
		}
	}
	if objA0.base_state == 0x04
	{
		if objA0.velocity.x > 0
			objA0.velocity.x -= 0x60
		if objA0.velocity.x < 0
			objA0.velocity.x += 0x60

		if global.act.apparent == 0
			hud.dirty.timer = 0
	}
	
	if objA0.base_state == 0x05
	{
		if objA0.flags2b == 0x00
		{
			if objA0.countdown_value == 59
				coldPeaksZone.spawnSnowball()
			if objA0.countdown_value > 0
				objA0.countdown_value -= 1
			UpdateMovementStraightSimple()

			if objA0.velocity.y > 0
				objA0.velocity.y -= 0x20
			else objA0.velocity.y = 0
			
			if objA0.countdown_value == 0
			{
				objA0.flags2b = 0x01
				objA0.countdown_value = 130
				playSound(0x9d)
			}
		}
		else if objA0.flags2b == 0x01
		{
			if objA0.countdown_value > 0
				objA0.countdown_value -= 1
			objA0.position.x.u16 = u16[0xffffb000 + 0x10]
			if objA0.countdown_value == 0
			{
				objA0.countdown_value = 60
				objA0.flags2b = 0x02
				playSound(0x51)
			}
		}
		else if objA0.flags2b == 0x02
		{
			if objA0.countdown_value > 0
				objA0.countdown_value -= 1
			if objA0.countdown_value == 0
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y -= 0x20
				if objA0.position.y.u16 < 0x466
				{
					if (boss.remaining_hits <= 4 && objA0.value26 == 0) || boss.remaining_hits > 4
						objA0.value26 = 1
					else objA0.value26 = 0
					if objA0.value26 == 1
					{
						objA0.velocity.y = 0
						objA0.velocity.x = 0
						objA0.position.x.u16 = 0x61c4 + (getScreenExtend() * 2) - 80
						coldPeaksZone.switchPattern()
					}
					else
					{
						objA0.flags2b = 0x00
						objA0.countdown_value = 60
						objA0.position.x.u16 = 0x60e5 + (getScreenExtend() * 2) - 80
						objA0.position.y.u16 = 0x0466 + (coldPeaksZone.lowerMechaTailsPosition() ? 16 : 0)
						objA0.velocity.x = 0x000
						objA0.velocity.y = 0x500
						objA0.value26 = 0
					}
				}
			}
		}
	}
	
	if objA0.base_state == 0x05 && objA0.flags2b <= 0x01
		coldPeaksZone.mechaTails.holdingSnowball = 1
	else coldPeaksZone.mechaTails.holdingSnowball = 0
	
	if coldPeaksZone.mechaTails.resultsTimer == 1
	{
		spawnChildObject(0x083d84, 0x00, 0, 0)		// Boss explosion generator
	}

	coldPeaksZone.MechaTailsDamageUpdate()

	if objA0.state > 0
		objA0.state -= 1

	if u8[A0 + 0x25] || boss.remaining_hits == 0 || objA0.state
	{
		objA0.collision_attributes = 0
		if (u8[A0 + 0x25])
			--u8[A0 + 0x25]
	}
	else
	{
		if objA0.base_state == 0x01 || (objA0.base_state == 0x03 && (objA0.flags2b == 0x01 || objA0.flags2b == 0x03))
			objA0.collision_attributes = (collision.size.16x16 | collision.flag.THREAT)
		else objA0.collision_attributes = (collision.size.16x16 | collision.flag.DESTRUCTIBLE)
	}

	coldPeaksZone.mechaTails.position.x = objA0.position.x.u16
	coldPeaksZone.mechaTails.position.y = objA0.position.y.u16
}

function void coldPeaksZone.MechaTailsDamageUpdate()
{
	if (u8[A0 + 0x28] != 0)
		return

	if (boss.remaining_hits == 0 && objA0.base_state < 0x04)
	{
		// Boss beaten
		objA0.state = 0
		coldPeaksZone.mechaTails.hasBeenFought = 1
		AddScoreForBossEnemy()
		hud.dirty.timer = 0
		objA0.base_state = 0x04
		return
	}

	if (objA0.state == 0 && boss.remaining_hits > 0)
	{
		if boss.remaining_hits == 4
		{
			coldPeaksZone.loadMechaTailsPalette(true, false)
			playSound(0x84)
		}
		if !Audio.isPlayingAudio("3db_boss2") && boss.remaining_hits <= 4
			Audio.playAudio("3db_boss2", 0)
		objA0.state = 40
		playSound(0x6e)
	}

	objA0.flags2a |= 0x40
}

function void coldPeaksZone.switchPattern()
{
	objA0.base_state = (objA0.base_state % 5)
	if objA0.base_state == 0
	{
		Audio.playAudio("coldpeakszone.mechatails.dash")
		objA0.position.x.u16 = camera.position.x.u16 + getScreenWidth() + 17
		objA0.position.y.u16 = 0x04d6
		objA0.velocity.x = -0x700
		objA0.base_state = 1
		objA0.flags2b = 0
	}
	else if objA0.base_state == 1
	{
		objA0.position.x.u16 = camera.position.x.u16 + getScreenWidth() + 17
		objA0.position.y.u16 = 0x04d5 + (coldPeaksZone.lowerMechaTailsPosition() ? 16 : 0)
		objA0.base_state = 2
		objA0.flags2b = 0x00
	}
	else if objA0.base_state == 2
	{
		objA0.position.x.u16 = camera.position.x.u16 + getScreenWidth() + 17
		objA0.position.y.u16 = 0x04d5 + (coldPeaksZone.lowerMechaTailsPosition() ? 16 : 0)
		objA0.velocity.x = -0x200
		objA0.base_state = 3
		objA0.flags2b = 0x00
	}
	else
	{
		objA0.flags2b = 0x00
		objA0.countdown_value = 60
		objA0.position.x.u16 = 0x60e5 - 40 + getScreenExtend()
		objA0.position.y.u16 = 0x0466 + (coldPeaksZone.lowerMechaTailsPosition() ? 16 : 0)
		objA0.base_state = 5
		objA0.velocity.x = 0x000
		objA0.velocity.y = 0x500
	}
}

function bool coldPeaksZone.lowerMechaTailsPosition()
{
	if getMainCharacter() == CHARACTER_KNUCKLES
		return true
	return false
}

function bool coldPeaksZone.destroyMechaTails()
{
	if getMainCharacter() == CHARACTER_KNUCKLES
		return true
	return false
}

//Energy Orb
function void coldPeaksZone.spawnEnergyBall()
{
	if (allocDynamicObjectStd())
	{
		objA1.update_address = addressof(coldPeaksZone.updateEnergyBall)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
		
		objA1.box_size.x = 24
		objA1.box_size.y = 24
		
		objA1.position.x.u16 = coldPeaksZone.mechaTails.position.x
		objA1.position.y.u16 = coldPeaksZone.mechaTails.position.y
		
		objA1.velocity.y = 0x600
	}
}

//# address-hook(0x200402)
function void coldPeaksZone.updateEnergyBall()
{
	objA0.box_size.x = 0x40
	objA0.box_size.y = 0x40
	
	objA0.hitbox_extends.x = 12
	objA0.hitbox_extends.y = 12
	
	objA0.collision_attributes = (collision.size.24x24 | collision.flag.THREAT)
	
	UpdateMovementStraightSimple()
	objA0.velocity.y += 0x20
	
	Enemy.DrawDynamicObject()
	
	if !(objA0.render_flags & render_flag.VISIBLE)
		UnloadObject()
}

//Laser
function void coldPeaksZone.spawnLaser()
{
	if (allocDynamicObjectStd())
	{
		objA1.update_address = addressof(coldPeaksZone.updateLaser)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
		
		objA1.box_size.x = 24
		objA1.box_size.y = 24
		
		objA1.position.x.u16 = coldPeaksZone.mechaTails.position.x
		objA1.position.y.u16 = coldPeaksZone.mechaTails.position.y

		u16[A1 + 0x46] = A0.u16
	}
}

//# address-hook(0x200404)
function void coldPeaksZone.updateLaser()
{
	objA0.box_size.x = 0x40
	objA0.box_size.y = 0x40
	
	objA0.hitbox_extends.x = 12
	objA0.hitbox_extends.y = 12
	
	objA0.collision_attributes = (collision.size.32x112 | collision.flag.THREAT)
	
	objA0.position.x.u16 = coldPeaksZone.mechaTails.position.x
	objA0.position.y.u16 = coldPeaksZone.mechaTails.position.y + 24

	A1 = 0xffff0000 + u16[A0 + 0x46]
	if (objA1.render_flags & render_flag.FLIP_X)
		objA0.render_flags |= render_flag.FLIP_X
	else objA0.render_flags &= ~render_flag.FLIP_X
	
	DrawObject()
	for (u32 address = 0xffffb000; address <= 0xffffb04a; address += 0x4a)
	{
		A1 = address
		if (checkBoxOverlap(objA0.position.x.u16 - objA0.hitbox_extends.x, objA0.position.y.u16 - objA0.hitbox_extends.y, objA0.hitbox_extends.x * 2, 120, objA1.position.x.u16 - objA1.hitbox_extends.x, objA1.position.y.u16 - objA1.hitbox_extends.y, objA1.hitbox_extends.x * 2, objA1.hitbox_extends.y * 2))
		{
			if (u8[A1 + 0x34] == 0 && (u8[A1 + 0x2a] & 0x08) == 0 && (u8[A1 + 0x2b] & char.bonus.INVINCIBLE) == 0)
				Enemy.DamageCharacter()
		}
	}
	
	if !(objA0.render_flags & render_flag.VISIBLE)
		UnloadObject()
	
	if !coldPeaksZone.mechaTails.isCharging
		UnloadObject()
}

//Drop Dash Dust
function void coldPeaksZone.spawnDropDashDust(bool flip)
{
	if (allocDynamicObjectStd())
	{
		objA1.update_address = addressof(coldPeaksZone.updateDropDashDust)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
		
		if flip
			objA1.render_flags |= render_flag.FLIP_X
		
		objA1.box_size.x = 24
		objA1.box_size.y = 24
		
		objA1.position.x.u16 = coldPeaksZone.mechaTails.position.x
		objA1.position.y.u16 = coldPeaksZone.mechaTails.position.y
		
		objA1.base_state = 0x00
		
		objA1.flags2e = 60
	}
}

//# address-hook(0x200406)
function void coldPeaksZone.updateDropDashDust()
{
	DrawObject()
	if objA0.countdown_value == 0x3c00
		objA0.countdown_value = 4
	
	if objA0.countdown_value > 0
		objA0.countdown_value -= 1

	if objA0.countdown_value == 0
	{
		objA0.countdown_value = 4
		objA0.base_state += 1
	}
	if objA0.base_state == 0x05
		UnloadObject()
}

//Snowball
function void coldPeaksZone.spawnSnowball()
{
	if (allocDynamicObjectStd())
	{
		objA1.update_address = addressof(coldPeaksZone.updateSnowball)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
		
		objA1.box_size.x = 64
		objA1.box_size.y = 64
		
		objA1.position.x.u16 = coldPeaksZone.mechaTails.position.x
		objA1.position.y.u16 = coldPeaksZone.mechaTails.position.y - 32
		
		objA1.velocity.y = 0x600
	}
}

//# address-hook(0x200408)
function void coldPeaksZone.updateSnowball()
{
	objA0.box_size.x = 72
	objA0.box_size.y = 72

	objA0.hitbox_extends.x = 32
	objA0.hitbox_extends.y = 32

	objA0.collision_attributes = (collision.size.32x32 | collision.flag.THREAT)

	if !coldPeaksZone.mechaTails.holdingSnowball
	{
		UpdateMovementStraightSimple()
		objA0.velocity.y += 0x39
		if (!coldPeaksZone.mechaTails.hitsRemaining)
		{
			objA0.collision_attributes = 0
			if (objA0.velocity.y == 0x639)
				objA0.velocity.y = 0
		}
	}
	else
	{
		UpdateMovementStraightSimple()
		objA0.position.x.u16 = coldPeaksZone.mechaTails.position.x
		objA0.position.y.u16 = coldPeaksZone.mechaTails.position.y - 32
	}

	Enemy.DrawDynamicObject()

	if objA0.position.y.u16 >= 0x0546
	{
		coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, 0x200, -0x500, false)
		coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, -0x200, -0x500, false)
		coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, 0x100, -0x600, false)
		coldPeaksZone.spawnSnowballParticles(objA0.position.x.u16, objA0.position.y.u16, -0x100, -0x600, false)
		playSound(0x49)
		UnloadObject()
	}
}

//Snowball Particles - used for boss giblets as well
function void coldPeaksZone.spawnSnowballParticles(u16 pos.x, u16 pos.y, s16 speed.x, s16 speed.y, bool shouldBeMechaTailsGibletsInstead)
{
	if (allocDynamicObjectStd())
	{
		objA1.update_address = addressof(coldPeaksZone.updateSnowballParticles)
		
		objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
		
		objA1.box_size.x = 24
		objA1.box_size.y = 24
		
		objA1.position.x.u16 = pos.x
		objA1.position.y.u16 = pos.y
		
		objA1.velocity.x = speed.x
		objA1.velocity.y = speed.y
		
		if shouldBeMechaTailsGibletsInstead
			objA1.base_state = shouldBeMechaTailsGibletsInstead
	}
}

//# address-hook(0x20040a)
function void coldPeaksZone.updateSnowballParticles()
{
	objA0.box_size.x = 12
	objA0.box_size.y = 12
	
	objA0.hitbox_extends.x = 12
	objA0.hitbox_extends.y = 12
	
	objA0.collision_attributes = (collision.size.24x24 | collision.flag.THREAT)
	
	UpdateMovementStraightSimple()
	objA0.velocity.y += 0x40
	
	DrawObject()
	
	if !(objA0.render_flags & render_flag.VISIBLE)
	{
		UnloadObject()
	}
}

//# address-hook(0x20040c)
function void coldPeaksZone.callSignpost()
{
	objA0.position.x.u16 = coldPeaksZone.mechaTails.position.x
	objA0.position.y.u16 = coldPeaksZone.mechaTails.position.y
	objA0.update_address = 0x085ba8
}


//# address-hook(0x085bda) end(0x085bf6)
function void fn085bda()
{
	if global.zone_act == 0x0500 && customZoneSelect.useAlternates == 1 && customZoneSelect.alternateZoneSet == 0
	{
		playMusic(0x0b)
		objA0.update_address = 0x085c00
		level.boss_encounter = 0

		spawnSimpleChildObjects(addressof(SignPost.BaseUpdate), 1)		// Signpost

		addPatternLoadingCue(0x085bc8)		// Signpost pole sprite
	}
	else base.fn085bda()
}

//# address-hook(0x085da8) end(0x085dd8)
function void fn085da8()
{
	if global.zone_act == 0x0500 && customZoneSelect.useAlternates == 1 && customZoneSelect.alternateZoneSet == 0
	{

	}
	else base.fn085da8()
}

//Cutscene Mecha Tails
function void coldPeaksZone.spawnMechaTailsCutsceneObject() //Used in LBZ as well
{
	if (allocDynamicObjectStd())
	{
		if coldPeaksZone.destroyMechaTails()
		{
			//Use an different object, for Knuckles' unique cutscene
			objA1.update_address = addressof(coldPeaksZone.updateKnucklesCutsceneObject)
			
			objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
			
			objA1.box_size.x = 0x40
			objA1.box_size.y = 0x40
			
			objA1.position.x.u16 = u16[0xffffb000 + 0x10]
			objA1.position.y.u16 = u16[0xffffb000 + 0x14]
			
			objA1.base_state = 0x00
			objA1.state = 0x00
		}
		else
		{
			objA1.update_address = addressof(coldPeaksZone.updateMechaTailsCutsceneObject)
			
			objA1.render_flags = (render_flag.WORLD | render_flag.VISIBLE)
			
			objA1.box_size.x = 0x40
			objA1.box_size.y = 0x40
			
			objA1.position.x.u16 = 0x6190
			objA1.position.y.u16 = 0x0466
			
			objA1.base_state = 0x00
			objA1.state = 0x00
		}
	}
}

//# address-hook(0x200414)
function void coldPeaksZone.updateKnucklesCutsceneObject()
{
	objA0.box_size.x = 12
	objA0.box_size.y = 12
	
	objA0.hitbox_extends.x = 12
	objA0.hitbox_extends.y = 12
	
	DrawObject()
	
	if coldPeaksZone.loadedPatterns == 0
		UnloadObject()
	
	if objA0.base_state == 0
	{
		if u16[0xffffb000 + 0x10] >= 0x6c00
		{
			u8[0xffffb000 + 0x46] = 0x0e
			u8[0xffffb000 + 0x47] = 0x0f
			if !player1.control_override
			{
				player1.control_override = 0xff
				playSound(0x87)
				control.player1 = 0x0000
				u8[0xffffb000 + 0x05] = base_state.HURT
				u8[0xffffb000 + 0x20] = char.state.GOT_HURT_PANIC
				u8[0xffffb000 + 0x2a] |= char.flag.IN_AIR
				s16[0xffffb000 + 0x18] = 0x100
				s16[0xffffb000 + 0x1a] = -0x400
			}
			else
			{
				if !(u8[0xffffb000 + 0x2a] & char.flag.IN_AIR)
				{
					Audio.fadeOutChannel(0, 2.5f)
					objA0.base_state = 1
					playSound(0x82)
				}
			}
		}
		objA0.position.x.u16 = u16[0xffffb000 + 0x10]
		objA0.position.y.u16 = u16[0xffffb000 + 0x14]
	}
	if objA0.base_state == 1
	{
		if objA0.value26 < 64
			objA0.value26 += 8
		objA0.position.y.u16 = u16[0xffffb000 + 0x14] - objA0.value26
		
		objA0.value32 += 1
		
		if objA0.value32 == 120 || objA0.value32 == 60 || objA0.value32 == 2
			playSound(0xa7)
		if objA0.value32 == 180
			playSound(0xad)
		
		if objA0.value32 > 180
		{
			if global.framecounter % 2 == 0
				Renderer.drawCustomSprite("icecapzone_ringshooter_trail", u16[0xffffb000 + 0x10], u16[0xffffb000 + 0x14] - ((objA0.value32 * 15) - (180 * 15)), 0x10, 0x20, 0x9e00)
			if level.framecounter & 0x05
				playSound(0xca)
			
			u8[0xffffb000 + 0x20] = char.state.DISAPPEARED
		}
		
		if objA0.value32 == 200
			TriggerNextZone(0x0600)
	}
}

//# address-hook(0x20040e)
function void coldPeaksZone.updateMechaTailsCutsceneObject()
{
	objA0.box_size.x = 0x40
	objA0.box_size.y = 0x40
	
	objA0.hitbox_extends.x = 16
	objA0.hitbox_extends.y = 16

	objA0.collision_attributes = 0
	
	if !(objA0.base_state == 0 && global.zone == 0x05)
		Enemy.DrawDynamicObject()
	
	if global.zone == 0x06
	{
		if (objA0.base_state != 3)
			UpdateMovementStraightSimple()

		if objA0.base_state == 0
		{
			if (objA0.state == 0)
			{
				objA0.state = 1
				spawnSimpleChildObjects(0x083d84, 1)
				if (_equal())
				{
					u8[A1 + 0x2c] = 0x12
					u16[A0 + 0x26] = A1.u16
				}
			}

			objA0.position.x.u16 = u16[0xffffb000 + 0x10] - 24
			objA0.position.y.u16 = u16[0xffffb000 + 0x14]
			objA0.velocity.y = s16[0xffffb000 + 0x1a]
			
			player1.control_override = 0xff
			control.player1 = 0x0000
			s16[0xffffb000 + 0x18] = 0
			
			if u16[0xffffb000 + 0x14] >= 0x0500
				objA0.base_state = 1
		}
		if objA0.base_state == 1
		{
			player1.control_override = 0x00
			s16[0xffffb000 + 0x18] = 0x300
			s16[0xffffb000 + 0x1a] = -0x300
			objA0.base_state = 2
		}
		
		if objA0.position.y.u16 >= 0x05c0 && objA0.base_state == 2
		{
			if Mods.isModActive("Triple Trouble 16-bit Effects") && System.getGlobalVariableValueByName("option.object_screenshake")
				playSound(0x5f)
			else
			{
				playSound(0x59)
				camera.screenshake.state = 0x14
			}
			objA0.position.y.u16 -= 12
			objA0.base_state = 3
			A1 = 0xffff0000 + u16[A0 + 0x26]
			UnloadObjectA1()
		}

		if (objA0.base_state == 3)
		{
			if (global.framecounter % 16 == 0)
			{
				// "spawnSimpleChildObjects(0x083256)" replaced by:
				spawnSimpleChildObjects(0x08218e, 1)
			}
		}
	}
	else
	{
		u8[0xffffb000 + 0x46] = 0x0c
		u8[0xffffb000 + 0x47] = 0x0d
		
		if coldPeaksZone.loadedPatterns == 0
			UnloadObject()
		
		if objA0.base_state > 0x00 && !(objA0.base_state == 0x01 && objA0.position.x.u16 < u16[0xffffb000 + 0x10])
		{
			camera.use_forced_target = true
			camera.forced_target.x = objA0.position.x.u16
			if objA0.base_state >= 0x03
				camera.forced_target.y = objA0.value42		
			else camera.forced_target.y = objA0.position.y.u16
		}
		
		if objA0.base_state == 0x00
		{
			if u16[0xffffb000 + 0x10] > 0x68d3
			{
				objA0.position.x.u16 = u16[0xffffb000 + 0x10] - 400
				objA0.position.y.u16 = u16[0xffffb000 + 0x14]
			}
			if u16[0xffffb000 + 0x10] >= 0x6c00
			{
				coldPeaksZone.loadMechaTailsPalette(false, false)
				Audio.playAudio("coldpeakszone.mechatails.dash")
				objA0.velocity.x = 0x2000
				objA0.base_state = 0x01
			}
		}
		if objA0.base_state == 0x01
		{
			if u16[0xffffb000 + 0x10] > 0x68d3
				objA0.position.y.u16 = u16[0xffffb000 + 0x14]
			if objA0.position.x.u16 < u16[0xffffb000 + 0x10] - 0x20
			{
				UpdateMovementStraightSimple()
				objA0.velocity.x += 0x40
			}
			else
			{	
				coldPeaksZone.surpriseflashTransparency = 1
				Audio.playAudio("kc_surprise", 0)
				hud.dirty.timer = 0
				playSound(0x59)
				objA0.base_state = 0x02
				objA0.velocity.x = 0
				objA0.countdown_value = 180
			}
		}
		if objA0.base_state == 0x02
		{
			u8[0xffffb000 + 0x2e] |= control_flag.DISABLE_UPDATE
			u8[0xffffb000 + 0x20] = char.state.GOT_HURT_PANIC
			u16[0xffffb000 + 0x10] = objA0.position.x.u16 + 24
			u16[0xffffb000 + 0x14] = objA0.position.y.u16 - 14
			
			if objA0.countdown_value > 0
				objA0.countdown_value -= 1
			
			if objA0.countdown_value > 90 && objA0.countdown_value <= 120
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y -= 0x15
			}
			else if objA0.countdown_value > 60 && objA0.countdown_value <= 90
			{
				if objA0.velocity.y < 0
				{
					UpdateMovementStraightSimple()
					objA0.velocity.y += 0x07
				}
			}
			else if objA0.countdown_value == 0
			{
				objA0.velocity.y = 0
				objA0.base_state = 0x03
				playSound(SFX_ROLL)
				objA0.countdown_value = 240
				objA0.value42 = objA0.position.y.u16
			}
		}
		if objA0.base_state == 0x03
		{
			if objA0.countdown_value > 0
				objA0.countdown_value -= 1
				
			u8[0xffffb000 + 0x2e] |= control_flag.DISABLE_UPDATE
			u8[0xffffb000 + 0x20] = char.state.ROLLING
			u16[0xffffb000 + 0x10] = objA0.position.x.u16 + 16
			u16[0xffffb000 + 0x14] = objA0.position.y.u16 - 6
			
			if objA0.countdown_value > 120 && objA0.countdown_value <= 180
			{
				UpdateMovementStraightSimple()
				objA0.velocity.y -= 0x20
			}
			else if objA0.countdown_value > 0 && objA0.countdown_value <= 120
			{
				if getMainCharacter() == CHARACTER_KNUCKLES
				{
					TriggerNextZone(0x0600)
					UnloadObject()
				}
				if global.framecounter % 4 == 0
					objA0.value42 -= 1
			}
			if objA0.countdown_value == 60
			{
				objA0.velocity.y = 0
				objA0.position.y.u16 = 0x027d - (0x029b - camera.position.y.u16)
				objA0.value3e = 0x029b - camera.position.y.u16
				objA0.base_state = 0x04
			}
		}
		if objA0.base_state == 0x04
		{
			if objA0.countdown_value > 0 && objA0.countdown_value <= 120
			{
				if global.framecounter % 4 == 0
					objA0.value42 -= 1
			}
			u8[0xffffb000 + 0x14] = 0x0281
			if global.framecounter % 2 == 0
				objA0.position.y.u16 += 2
			if objA0.position.y.u16 >= 0x0300 - objA0.value3e
			{	
				TriggerNextZone(0x0600)
				UnloadObject()
			}
		}
	}
}

function void coldPeaksZone.loadMechaTailsPalette(bool pinch, bool justASingleColor)
{
	string paletteKey = ColdPeaksZone.getBossSpriteSheet()
	u16 numColors = System.loadExternalPaletteData(paletteKey, pinch, 0x800000, 0x20)
	
	if (numColors > 0)
	{
		for (u16 i = 0; i < numColors; ++i)
		{
			if justASingleColor
				u16[0x802000 + 0xc0 + 0x80 + 0x1e] = packColor(u32[0x800000 + 0x3c])
			else u16[0x802000 + 0xc0 + 0x80 + i * 2] = packColor(u32[0x800000 + i * 4])
		}
	}
}

function bool Standalone.onWriteToSpriteTable(s16 px, s16 py, u16 renderQueue)
{
	string sheet = ColdPeaksZone.getBossSpriteSheet()
	if (objA0.update_address == 0x200402)
	{
		Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.energyball.3", px, py, 0xe0, 0, 0x9f02)
		if level.framecounter & 0x01
			Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.energyball.2", px, py, 0xe0, 0, 0x9f03)
		return true
	}
	if (objA0.update_address == 0x200404)
	{
		Renderer.drawCustomSprite(stringformat("coldPeaksZone.mechaTails.other.laser.%d", (level.framecounter / 2 % 2) + 1), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9f02)
		return true
	}
	if (objA0.update_address == 0x200400)
	{
		if objA0.state && (global.framecounter / 2) % 2 == 0
			u16[0x802000 + 0xde + 0x80] = 0x0eee
		else coldPeaksZone.loadMechaTailsPalette(boss.remaining_hits <= 4, true)
		
		if objA0.countdown_value < 20 && objA0.base_state == 0x02
			coldPeaksZone.mechaTails.isCharging = 1
		else coldPeaksZone.mechaTails.isCharging = 0
		
		string key
		if objA0.base_state == 0x01
		{
			key = stringformat("dash.%d", (global.framecounter / 2) % 3 + 1)
			s16 px1 = px
			for (u8 i; i < 4; ++i)
			{
				if boss.remaining_hits > 4
					break
				px1 -= objA0.velocity.x / 0x80
				Renderer.drawSprite(stringformat("coldPeaksZone.%s.%s", sheet, key), px1, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9efe, 0, 0xff - (i * 0x40))
			}
		}
		else if (objA0.base_state == 0x03 && (objA0.flags2b == 0x01 || objA0.flags2b == 0x03))
		{
			Renderer.drawCustomSprite(stringformat("coldPeaksZone.%s.tails.2", sheet), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9eff, -((global.framecounter * 16) % 256), 0xff)
			key = stringformat("roll.%d", (global.framecounter / 3) % 3 + 1)
		}
		else if boss.remaining_hits <= 4 && objA0.countdown_value < 20 && objA0.base_state == 0x02
		{
			if objA0.countdown_value < 20
				key = "laser"
		}
		else if objA0.countdown_value < 10 && objA0.base_state == 0x02
		{
			key = "charge.2"
			if level.framecounter & 0x01
				Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.energyball.1", px + (objA0.render_flags & render_flag.FLIP_X ? -1 : 1), py + 6, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9f01)
		}
		else if objA0.countdown_value < 20 && objA0.base_state == 0x02
		{
			key = "charge.1"
			if level.framecounter & 0x01
				Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.energyball.1", px + (objA0.render_flags & render_flag.FLIP_X ? -2 : 2), py + 5, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9f01)
		}
		else if objA0.base_state == 0x04
		{
			if coldPeaksZone.mechaTails.resultsTimer < 90
			{
				coldPeaksZone.loadMechaTailsPalette(false, false)
				key = "defeat.3"
			}
			else if coldPeaksZone.mechaTails.position.y < 0x0546
				key = "defeat.1"
			else key = "defeat.2"
		}
		else if objA0.base_state == 0x05
		{
			if objA0.flags2b <= 0x01
				key = "snowball.1"
			else key = "snowball.2"
		}
		else
			key = "idle"
		Renderer.drawSprite(stringformat("coldPeaksZone.%s.%s", sheet, key), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9eff)
		if !(objA0.base_state == 0x03 && (objA0.flags2b == 0x01 || objA0.flags2b == 0x03)) && objA0.base_state != 0x01 && objA0.base_state != 0x04 && !(boss.remaining_hits <= 4 && objA0.countdown_value < 20 && objA0.base_state == 0x02)
			coldPeaksZone.renderMechaTailsTails(px, py, sheet)
		return true
	}
	if (objA0.update_address == 0x200406)
	{
		string key
		key = stringformat("coldPeaksZone.mechaTails.other.dropdashdust.%d", 1 + objA0.base_state)
		Renderer.drawCustomSprite(key, px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9e00)
	}
	if (objA0.update_address == 0x200408)
	{
		Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.snowball.big", px, py, 0x20, (objA0.render_flags & render_flag.FLIP_X), 0x9d7e)
		return true
	}
	if (objA0.update_address == 0x20040a)
	{
		string key
		key = stringformat("giblet.%d", objA0.base_state)
		if objA0.base_state > 0
			Renderer.drawCustomSprite(stringformat("coldPeaksZone.%s.%s", sheet, key), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9f01)
		else Renderer.drawCustomSprite("coldPeaksZone.mechaTails.other.snowball.small", px, py, 0x20, (objA0.render_flags & render_flag.FLIP_X), 0x9d7e)
		return true
	}
	if (objA0.update_address == 0x20040e)
	{
		string key
		if objA0.base_state == 0x01
			key = stringformat("dash.%d", (global.framecounter / 2) % 3 + 1)
		else if objA0.base_state == 0x02
			key = "cutscene.1"
		else if objA0.base_state == 0x03 && objA0.countdown_value > 120 && objA0.countdown_value <= 180
			key = stringformat("cutscene.%d", (global.framecounter / 2) % 2 + 3)
		else if objA0.base_state == 0x04
		{
			px = getScreenWidth() / 2 - (py / 4)
			float scale = 1.0f - (py / 112.0f)
			key = stringformat("dashgfx.%d", (global.framecounter / 2) % 2 + 1)
			Renderer.drawSpriteTinted(stringformat("coldPeaksZone.mechaTails.%s", key), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X) | (objA0.render_flags & render_flag.FLIP_Y), 0x9f01, 0, 0xffffffff, scale)
			return true
		}
		else key = "cutscene.2"
		if global.zone_act == 0x0600
		{
			objA0.render_flags |= render_flag.FLIP_Y
			key = "cutscene.1"
			if global.framecounter % 2 == 0 && objA0.base_state < 3
				Renderer.drawCustomSprite("coldPeaksZone.mechaTails.dashgfx.3", px, py, 0xe0, 0, 0x9f01)
		}
		Renderer.drawCustomSprite(stringformat("coldPeaksZone.%s.%s", sheet, key), px, py, 0xe0, (objA0.render_flags & render_flag.FLIP_X) | (objA0.render_flags & render_flag.FLIP_Y), 0x9f01)
		if objA0.base_state != 0x01 && objA0.base_state != 0x04 && !(global.zone_act == 0x0600 && objA0.base_state == 3)
			coldPeaksZone.renderMechaTailsTails(px - 3, py, sheet)
		return true
	}
	if (objA0.update_address == 0x200414) && (objA0.base_state > 0)
	{
		Renderer.drawCustomSprite("icecapzone_teleportercannon", px, py, 0x20, 0, 0x9f01)
		
		string key
		if ((240 - objA0.value32) / 60) < 4
			key = stringformat("icecapzone_teleporter_countdown%d", (240 - Math.roundToInt(objA0.value32)) / 60)
		else key = "icecapzone_teleporter_countdown4"
		if global.framecounter % 2 == 0
			Renderer.drawCustomSprite(key, px - 50, py, 0x20, 0, 0x9f01)
		
		Renderer.drawCustomSprite("icecapzone_ringshooter_countdown", px - 50, py, 0x20, 0, 0x9f01)
		return true
	}
	if (objA0.mapping_offset == 0x083ffc) && ((customZoneSelect.useAlternates == 1 && customZoneSelect.alternateZoneSet == 0 && global.zone_act == 0x0500) || global.zone_act == 0x0600 && timer.alldata < 300)
	{
		string key
		key = stringformat("coldPeaksZone.mechaTails.other.explosion.%d", objA0.animation.sprite + 1)
		Renderer.drawCustomSprite(key, px, py, 0x00, 0, renderQueue)
		return true
	}
	if objA0.update_address == 0x0821c2 && global.zone_act == 0x0600
	{
		objA0.velocity.y = -0x100
		Renderer.drawSpriteTinted("coldPeaksZone.mechaTails.other.explosion.1", px + 8, py + 10, 0x00, 0, renderQueue, 0, 0x00226680 - objA0.countdown_value, objA0.countdown_value / 80.0f)
		return true
	}
	return base.Standalone.onWriteToSpriteTable(px, py, renderQueue)
}

//# address-hook(0x0821c2) end(0x0821d8)
function void fn0821c2()
{
	if (global.zone_act == 0x0600)
	{
		if (objA0.countdown_value == 0)
		{
			objA0.velocity.x = (System.rand() % 0x80) - 0x40
		}
		objA0.countdown_value++
		UpdateMovementStraightSimple()
		if (objA0.countdown_value > 80)
			UnloadObject()
		DrawObject()
		return
	}
	base.fn0821c2()
}

function void coldPeaksZone.renderMechaTailsTails(s16 px, s16 py, string sheet)
{
	Renderer.drawCustomSprite(stringformat("coldPeaksZone.%s.tails.1", sheet), px, py + 5, 0xe0, (objA0.render_flags & render_flag.FLIP_X), 0x9eff, -((global.framecounter * 12) % 256), 0xff)
}

function string ColdPeaksZone.getBossSpriteSheet()
{
	return ColdPeaksZone.getBossSpriteSheet[coldPeaksZone.bossSprite]
}

constant array<string> ColdPeaksZone.getBossSpriteSheet =
{
	"mechaTails",
	"fakerTails"
}

function string getBossLifeIcon(s16 px, s16 py, u16 renderQueue)
{
	if (System.getGlobalVariableValueByName("currentRegBossUpdateAddress") == 0x200400)
		return stringformat("coldPeaksZone.%s.other.life", ColdPeaksZone.getBossSpriteSheet())

	return base.getBossLifeIcon(px, py, renderQueue)
}

function void RegisterBossHealthBar(u32 healthAddress, u8 picture, s8 healthAdjustment)
{
	// Prevents erros from appearing if the "Bosses That Got A Life" mod isn't present
	base.RegisterBossHealthBar(healthAddress, picture, healthAdjustment)
}
